#define _CRT_SECURE_NO_WARNINGS 1
#include"SList.h"

void TestSLT1()
{
	SLNode* plist = NULL;
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);
	SLTPrint(plist);

	SLTPopBack(&plist);
	SLTPrint(plist);

	SLTPopBack(&plist);
	SLTPrint(plist);

	SLTPopBack(&plist);
	SLTPrint(plist);

	SLTPopBack(&plist);
	SLTPrint(plist);
	
	/*SLTPopBack(&plist);
	SLTPrint(plist);*/
}

void TestSLT2()
{
	SLNode* plist = NULL;
	SLTPushFront(&plist, 1);
	SLTPushFront(&plist, 2);
	SLTPushFront(&plist, 3);
	SLTPushFront(&plist, 4);
	SLTPrint(plist);

	SLTPopFront(&plist);
	SLTPrint(plist);

	SLNode* pos = SLTFind(plist, 3);
	//SLTInsert(&plist, pos, 30);
}

void TestSLT3()
{
	SLNode* plist = NULL;
	//SLTInsert(&plist, NULL, 1);
	SLTPushFront(&plist, 1);
	SLTPushFront(&plist, 2);
	SLTPushFront(&plist, 3);
	SLTPushFront(&plist, 4);
	SLTPrint(plist);

	SLNode* pos = SLTFind(plist, 4);
	//SLTInsert(&plist, pos, 40);
	SLTPrint(plist);

	pos = SLTFind(plist, 2);
	//SLTInsert(&plist, pos, 20);
	SLTPrint(plist);

	//pos = SLTFind(plist, 200);
	//SLTInsert(&plist, pos, 2);
}

void TestSLT4()
{
	SLNode* plist = NULL;
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);
	SLTPrint(plist);

	SLNode* pos = SLTFind(plist, 1);
	//SLTErase(&plist, pos);
	SLTPrint(plist);

	pos = SLTFind(plist, 3);
	//SLTErase(&plist, pos);
	SLTPrint(plist);
}

void TestSLT5()
{
	SLNode* plist = NULL;
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);
	SLTPrint(plist);

	SLNode* pos = SLTFind(plist, 1);
	SLTInsertAfter(pos, 10);
	SLTPrint(plist);

	SLTEraseAfter(pos);
	SLTPrint(plist);

	SLTDestroy(&plist);
}

int main()
{
	TestSLT1();

	return 0;
}